Ext.define("ZYY.view.system.deptGrid",{
	extend:"Ext.grid.Panel",
	alias : 'widget.deptGrid',//别名   
 	store:'system.deptGrid',
    columns: [
        {text: "ID", flex: 1, sortable: true, dataIndex: 'deptid',hidden:true},
        {text: "部门名称", flex: 1, sortable: true, dataIndex: 'deptname'},
        {text: "上级部门名称", flex: 1, sortable: true, dataIndex: 'pname'},
        {text: "排序号", flex: 1, sortable: true, dataIndex: 'sortno'},
        {dataIndex:"pid",hidden:true}
    ],
    columnLines: true,
    initComponent : function() {
    	Ext.apply(this, {
	        selModel: Ext.create('Ext.selection.CheckboxModel', {
			        listeners: {
			            selectionchange: function(sm, selections) {
			            	(Ext.ComponentQuery.query('deptList toolbar button[action=delete]')[0]).setDisabled(selections.length == 0);
			            	(Ext.ComponentQuery.query('deptList toolbar button[action=edit]')[0]).setDisabled(selections.length != 1);
			            }
			        }
			  })
        });
		this.callParent(arguments);
		//this.store.load();//如果要在这里写就要放在callParent(arguments)后面，现在放到controller里面了
	}
});